private var urlReq:URLRequest;
import com.adobe.utils.StringUtil;

import flash.external.ExternalInterface;

import mx.controls.Alert;
import mx.messaging.messages.ErrorMessage;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;

import pages.user.UserModel;	

	private function login():void
	{
		var userModel:UserModel=new UserModel();
		userModel.userId=userId.text;
		userModel.userPassword=userPassword.text;
		loginPage.login(userModel);  
	}
	
	private function loginResult(event:ResultEvent):void{
		var user:UserModel=event.result as UserModel;  
		if (StringUtil.stringsAreEqual(user.userRole,"A",true)){
		  	ExternalInterface.call("function(){window.location.href='adminPanel.html';}");
		}else if (StringUtil.stringsAreEqual(user.userRole,"C",true)){
		  	ExternalInterface.call("function(){window.location.href='adminPanel.html';}");
		}
	}
	
	private function getFault(event:FaultEvent):void {  
        var errorMessage:ErrorMessage = event.message as ErrorMessage;
		Alert.show(errorMessage.rootCause.message);
    }